package io.pwbwdemo.pwbw02;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PW {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("fos.txt");
        OutputStreamWriter osw =  new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        System.out.println("开始写吧");
        Scanner scan = new Scanner(System.in);

        while (true){
            String  line = scan.nextLine();
            if ("exit".equals(line)){
                System.out.println("程序退出");
                break;
            }
            pw.println(line);

        }
        pw.close();






    }
}
